<?php
class Participante extends AppModel {
	var $name = 'Participante';
	
		//The Associations below have been created with all possible keys, those that are not needed can be removed

	var $virtualFields = array(
    	'nombre_completo' => 'CONCAT(UCASE(SUBSTRING(Participante.primer_apellido,1,1)), LOWER(SUBSTRING(Participante.primer_apellido,2)), 
    						  " ", UCASE(SUBSTRING(Participante.segundo_apellido,1,1)), LOWER(SUBSTRING(Participante.segundo_apellido,2)), 
    						  " ", UCASE(SUBSTRING(Participante.primer_nombre,1,1)), LOWER(SUBSTRING(Participante.primer_nombre,2)),
    						  " ", UCASE(SUBSTRING(Participante.segundo_nombre,1,1)), LOWER(SUBSTRING(Participante.segundo_nombre,2)))'
    );  
    
    var $validate = array(
        'documento' => array(
            'required' => array('rule' => 'notEmpty'),
            'minlength' => array('rule' => array('minLength', 7), 'message'=>'El documento debe tener mas caracteres')
        )
    );
    
	

	var $belongsTo = array(
		'MunicipioExpedicion' => array(
			'className' => 'Municipio',
			'foreignKey' => 'municipio_expedicion_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'MunicipioNacimiento' => array(
			'className' => 'Municipio',
			'foreignKey' => 'municipio_nacimiento_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'MunicipioResidencia' => array(
			'className' => 'Municipio',
			'foreignKey' => 'municipio_residencia_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'Ciclo' => array(
			'className' => 'Ciclo',
			'foreignKey' => 'ciclo_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'Grupo' => array(
			'className' => 'Grupo',
			'foreignKey' => 'grupo_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);

	var $hasMany = array(
		
		'Asistencia' => array(
			'className' => 'Asistencia',
			'foreignKey' => 'participante_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),
		'Prueba' => array(
			'className' => 'Prueba',
			'foreignKey' => 'participante_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),		
		'Asistcomplementaria' => array(
			'className' => 'Asistcomplementaria',
			'foreignKey' => 'participante_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),
		'Transferido' => array(
			'className' => 'Transferido',
			'foreignKey' => 'participante_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);
}
?>